home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Science⁄Math / VideoToolbox / VideoToolboxSources / SetMouse.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-29  |  1.7 KB  |  55 lines  |  [TEXT/KAHL]

  1. /*
  2. SetMouse.c
  3.  
  4. Sets the mouse location to the given point, which is specified in the local
  5. coordinate system of the current port.
  6.  
  7. WARNING: In the Q & A Stack, Apple tells you how to do this, but warns that the
  8. technique uses undocumented low-memory locations that are considered unsupported
  9. and volatile and may change in future CPUs.
  10.  
  11. From "Code gadgets: Setting the mouse location", THINKin' CaP, 1(2):28-29, Fall 1990.
  12.  
  13. Copyright © 1991 SPLAsh Resources. All rights reserved. This source code is
  14. copyrighted, but free. This means that programmers may use the code and
  15. incorporate it into their own programs (commercial or otherwise) without payment
  16. of any fees. However, the source code itself may not be sold or distributed on
  17. electronic bulletin board services without written permission from SPLAsh
  18. Resources.
  19.  
  20. SPLAsh Resources
  21. 1678 Shattuck Ave #302
  22. Berkeley, CA  94709
  23. (415) 527-0122
  24.  
  25. HISTORY:
  26. 2/25/91 dgp added to VideoToolbox
  27. 8/24/91    dgp    Made compatible with THINK C 5.0.
  28. */
  29. #include "VideoToolbox.h"
  30.  
  31. #if THINK_C==1    /* old version */
  32.     extern    Point    MTemp        :    0x828;        /* Low memory globals */
  33.     extern    Point    RawMouse    :    0x82C;
  34.     extern    Byte    CrsrNew        :    0x8CE;
  35.     extern    Byte    CrsrCouple    :    0x8CF;
  36. #else
  37.     #include <SysEqu.h>
  38.     #define MTemp (*(Point *)MTemp)
  39.     #define RawMouse (*(Point *)RawMouse)
  40.     #define CrsrNew (*(Byte *)CrsrNew)
  41.     #define CrsrCouple (*(Byte *)CrsrCouple)
  42. #endif
  43.  
  44. void SetMouse(Point    where)
  45. {
  46.     LocalToGlobal(&where);        /* Convert point to global coordinates    */
  47.     
  48.     /* Quoting from the Q & A Stack: "If you wish to place the cursor in an    */
  49.     /* absolute location on the screen, you must set RawMouse, and MTemp to    */
  50.     /* the same value, and set CrsrNew to the same value as CrsrCouple."    */
  51.         
  52.     MTemp=RawMouse=where;
  53.     CrsrNew=CrsrCouple;
  54. }
  55.